package com.lkj.bytebuf;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;

public class ByteBufTest {

    public static void main(String[] args) {
        String str = "Hello world";
        byte[] bytes = str.getBytes();
        ByteBuf buffer = Unpooled.buffer(bytes.length);
        buffer.writeBytes(bytes);
//        buffer.getBytes()
        for (int i = 0; i < buffer.capacity(); i++) {

            byte b = buffer.getByte(i);
            System.out.println((char)b);

        }
    }
}
